﻿namespace MicroCloud.Audit
{
    /// <summary>
    /// 审计模块
    /// </summary>
    [Description("审计模块")]
    public class AuditPack : AuditPackBase
    {
        /// <summary>
        /// 获取 模块启动顺序编号
        /// <para>模块启动的顺序先按级别启动，级别内部再按此顺序启动，级别默认为0，表示无依赖，需要在同级别有依赖顺序的时候，再重写为 >0 的顺序值。</para>
        /// </summary>
        public override int OrderNo => 0;

        /// <summary>
        /// 将模块服务添加到依赖注入服务容器中
        /// </summary>
        /// <param name="services">依赖注入服务容器</param>
        /// <returns></returns>
        public override IServiceCollection AddServices(IServiceCollection services)
        {
            services.AddScoped<IAuditHandler, AuditHandler>();
            services.AddScoped<IAuditContract, AuditService>();

            //注册DTO对象映射
            services.AddSingleton<IMapTuple, AutoMapperAuditConfiguration>();

            return base.AddServices(services);
        }

    }
}